<template>
<view class="page__bd page__bd_bottom">
	<custom-navbar bgColor="bg-white shadow" :isBack="true" :isHome="true">
		<block slot="backText">返回</block>
		<block slot="content">订单详情</block>
	</custom-navbar>
	<view class="daui-cells margin-top-no">
		<view class="daui-cell order-header">
			<view class="daui-cell__bd">
				<view class="order-title">{{orderInfo.status_title}}</view>
				<view class="order-reason">{{orderInfo.status_reason}}</view>
				<view class="order-reason" v-if="orderInfo.trade_status==1 && orderInfo.validation_status==1">
					<xwCountDown :is-day="false" :tip-text="'剩余'" :day-text="' '" :hour-text="'时'" :minute-text="'分'" :second-text="'秒'" :datatime="orderInfo.pay_over_time"></xwCountDown>
				</view>
				<view class="order-reason" v-if="orderInfo.trade_status==3">
					<xwCountDown :is-day="true" :tip-text="'剩余'" :day-text="'天'" :hour-text="'时'" :minute-text="'分'" :second-text="'秒'" :datatime="orderInfo.receive_over_time"></xwCountDown>
				</view>
			</view>
			<view class="daui-cell__ft">
				<image :src="orderInfo.status_img" class="order-status-img" mode="widthFix"></image>
			</view>
		</view>
		<view class="daui-media daui-media_appmsg daui-media_xs" v-if="orderInfo.ord_type==1 && orderInfo.delivery_mode==2">
			<view class="daui-media__hd">
				<text class="iconfontzz icon-location text-gray text-xxl"></text>
			</view>
			<view class="daui-media__bd">
				<view>
					<text class="text-bold">{{consigneeInfo.realname}}</text>
					<text class="margin-lr-sm">{{consigneeInfo.mobile}}</text>
				</view>
				<view class="daui-media__work">
					<text class="daui-badge bg-green margin-right-xs" v-if="consigneeInfo.type_show">{{consigneeInfo.type_show}}</text>
					{{consigneeInfo.province}}{{consigneeInfo.city}}{{consigneeInfo.district}}{{consigneeInfo.address}}
				</view>
			</view>
		</view>
		<view class="daui-media daui-media_appmsg daui-media_xs" v-if="orderInfo.ord_type==1 && orderInfo.delivery_status==2">
			<view class="daui-media__hd">
				<text class="iconfontzz icon-deliver text-cyan text-xxl"></text>
			</view>
			<view class="daui-media__bd">
				<view class="">快递公司：{{orderInfo.expresscomp_name}} 单号：{{orderInfo.express_no}}</view>
				<view class="">{{orderInfo.delivery_time_show}}</view>
			</view>
		</view>
	</view>
	<view class="daui-card daui-card__full daui-card_access daui-card_one delivery-wrap" v-if="orderInfo.ord_type==1 && (orderInfo.delivery_mode==1 || orderInfo.delivery_mode==4)">
		<view class="daui-card__hd">
			配送方式
			<span class="text-blue pull-right">{{orderInfo.delivery_mode_show}}</span>
		</view>
		<view class="daui-card__bd" v-if="orderInfo.ord_type == 1">
			<view class="daui-media daui-media_appmsg daui-media_user" v-if="orderInfo.delivery_mode==1">
				<view class="daui-media__hd">
					<image :src="selfpickupInfo.logo_show" mode="widthFix"></image>
				</view>
				<view class="daui-media__bd">
					<view class="daui-media__title">自提点名称：{{selfpickupInfo.name}}</view>
					<view class="daui-media__desc">联系人：{{selfpickupInfo.contact}}</view>
					<view class="daui-media__desc">电话：{{selfpickupInfo.phone}}</view>
					<view class="daui-media__desc">地址：{{selfpickupInfo.address}}</view>
					<view class="daui-media__hr" style="display: none;"></view>
					<block v-for="(item, index) in leavemess_fields" :key="index">
						<view class="daui-cell daui-cell_sm J_user_wrap">
							<view class="daui-cell__hd">{{item.name}}</view>
							<view class="daui-cell__bd weui-cell_primary">
								{{item.defaultValue}}
							</view>
						</view>
					</block>
					<view class="daui-cell" v-if="0 && isLeavemessOpen == 0">
						<view class="daui-cell__bd daui-cell_primary">
							<span class="mg-r-10 fw700">我的姓名：</span>{{orderInfo.realname}}
						</view>
					</view>
					<view class="daui-cell" v-if="0 && isLeavemessOpen == 0">
						<view class="daui-cell__bd daui-cell_primary">
							<span class="mg-r-10 fw700">我的手机：</span>{{orderInfo.mobile}}
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
	
	<view class="daui-card daui-card__full daui-card_access daui-card_one" v-if="orderInfo.ord_type==1">
		<view class="daui-card__hd">商品清单</view>
		<view class="daui-card__bd">
			<view class="daui-media daui-media_appmsg daui-media_product" v-for="(item,index) in orderProduct" :key="index" @click="openProductDetail(item.pid)">
				<view class="daui-media__hd">
					<image class="daui-media__thumb" :src="item.logo_show"></image>
				</view>
				<view class="daui-media__bd">
					<view class="daui-media__title">{{item.prod_name}}</view>
					<view class="daui-media__desc" v-if="item.subtitle">{{item.subtitle}}</view>
					<view class="daui-media__desc">品牌：{{item.brand_name}}<text class="margin-left-xs">产地：{{item.originplace}}</text></view>
					<view class="daui-media__desc">包装方式：{{item.package}}<text class="margin-left-xs">重量：{{item.weight}}kg</text></view>
					<view class="daui-media__work margin-top-xs" v-if="item.is_spec_open==1">
						规格：<text>{{item.spec_1}}</text>
						<text v-if="item.spec_2">，{{item.spec_2}}</text>
					</view>
					<view class="daui-media__work" v-if="0">
						购买{{item.buy_num}}，赠送{{item.give_num}}，实际{{item.reality_num}}
						<text class="zzui-feedtag line-green ml10">满{{item.full_num}}送{{item.give_num}}</text>
					</view>
					<view class="daui-media__subbox margin-top-sm">
						<view class="daui-media__subbox_hd">
							数量*{{item.reality_num}}
							<text v-if="item.delivery_mode == 1 && item.has_writeoff_num > 0">已核销{{item.has_writeoff_num}}，剩余{{item.leave_num}}</text>
						</view>
						<view class="daui-media__subbox_bd">
							<text class="text-price text-red text-xl">{{item.product_fee}}</text>
						</view>
					</view>
					<view class="daui-media__work" v-if="item.lite_content">
						<text class="zzui-feedtag line-red">{{item.lite_content}}</text>
					</view>
					<view class="daui-media__three" v-if="0">
						<a href="javascript:;" class="weui-btn wenew-btn_plain_warm wenew-btn_xs fr J_showMessage">查看留言</a>
					</view>
				</view>
			</view>
		</view>
	</view>
	<view class="daui-card daui-card__full daui-card_access" v-else-if="orderInfo.ord_type==21">
		<view class="daui-card__bd">
			<view class="daui-media daui-media_appmsg">
				<view class="daui-media__bd">
					<view class="daui-media__title">会员卡类型：{$cardInfo['name']}</view>
					<view class="daui-media__work">会员卡价格：￥{$cardInfo['real_price']}元</view>
					<view class="daui-media__second">有效期：{$cardInfo['expire_type_show']}</view>
					<view class="daui-media__second">购买数量：1</view>
				</view>
			</view>
		</view>
	</view>
	<view class="daui-card daui-card__full daui-card_access" v-else-if="orderInfo.ord_type==31">
		<view class="daui-card__bd">
			<view class="daui-media daui-media_appmsg">
				<view class="daui-media__bd">
					<view class="daui-media__title">{{balance_name}}充值</view>
					<view class="daui-media__second">
						{{recordInfo.amount}}元，赠送{{recordInfo.give}}元，实得{{recordInfo.realamount}}元
					</view>
				</view>
			</view>
		</view>
	</view>
	<view class="daui-card daui-card__full daui-card_access" v-else-if="orderInfo.ord_type==41">
		<view class="daui-card__bd">
			<view class="daui-media daui-media_appmsg">
				<view class="daui-media__bd">
					<view class="daui-media__title">扫码付款</view>
					<view class="daui-media__we_second">
						<view>{{orderInfo.total_fee}}元</view>
						<view>备注：{{orderInfo.content}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
	
	<view class="daui-card daui-card_access daui-card_one" v-if="(orderInfo.trade_status == 2 || orderInfo.trade_status == 4) && orderInfo.writeoff_mode == 1">
		<view class="daui-card__hd">订单二维码核销</view>
		<view class="daui-card__bd">
			<view class="daui-cell">
				<view class="daui-cell__bd">
					<view class="qyhexiao-block"><span class="qyhexiao-btn">待核销</span></view>
				</view>
			</view>
			<view class="daui-cell qrcode-cell">
				<view class="daui-cell__bd">
					<tki-qrcode cid="qrcode1" ref="qrcode1" :val="writeoffUrl" :size="240" :loadMake="true" :usingComponents="true" @result="qrR" />
				</view>
			</view>
			<view class="daui-cell" style="display: none;">
				核销码核销：
			</view>
			<view class="daui-cell" style="display: none;">
				<a href="{:url('mobmall/myOrderFinish/codeWriteoff', ['orderId'=>$orderId])}" class="weui-btn weui-btn_plain-primary weui-btn_mini J_layerDialog" data-tip="请输入领奖暗号">立即核销</a>
			</view>
		</view>
	</view>
	
	<view class="daui-card daui-card__full daui-card_access daui-card_one">
		<view class="daui-card__hd">费用明细</view>
		<view class="daui-card__bd daui-cells-preview">
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd">商品金额:</view>
				<view class="daui-cell__bd">
					<text class="text-price text-red text-xl">{{orderInfo.product_fee}}</text>
				</view>
			</view>
			<view class="daui-cell daui-cell_sm" v-if="orderInfo.ord_type == 1">
				<view class="daui-cell__hd">运费金额:</view>
				<view class="daui-cell__bd">
					<text class="text-price text-red text-xl">{{orderInfo.delivery_fee}}</text>
				</view>
			</view>
			<view class="daui-cell daui-cell_sm" v-if="orderInfo.coupon_fee != '0.00'">
				<view class="daui-cell__hd">优惠金额:</view>
				<view class="daui-cell__bd">
					<text class="text-price text-red text-xl">{{orderInfo.coupon_fee}}</text>
				</view>
			</view>
			<view class="daui-cell daui-cell_sm" v-if="mallConfigInfo.is_gold_open == 1 && orderInfo.gold_fee != '0.00'">
				<view class="daui-cell__hd">抵扣金额:</view>
				<view class="daui-cell__bd">
					<text class="text-price text-red text-xl">{{orderInfo.gold_fee}}</text>
				</view>
			</view>
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd">应付金额:</view>
				<view class="daui-cell__bd">
					<text class="text-price text-red text-xl">{{orderInfo.total_fee}}</text>
				</view>
			</view>
		</view>
	</view>
	
	<view class="daui-card daui-card__full daui-card_access daui-card_one" v-if="orderInfo.bil_no">
		<view class="daui-card__hd">单据信息</view>
		<view class="daui-card__bd daui-cells-preview">
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd">单据号码:</view>
				<view class="daui-cell__bd">{{orderInfo.bil_no}}</view>
			</view>
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd">单据ID:</view>
				<view class="daui-cell__bd">{{orderInfo.bil_id}}</view>
			</view>
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd">单据项次:</view>
				<view class="daui-cell__bd">{{orderInfo.bil_itm}}</view>
			</view>
		</view>
	</view>
	
	<view class="daui-card daui-card__full daui-card_access daui-card_one">
		<view class="daui-card__hd">订单信息</view>
		<view class="daui-card__bd daui-cells-preview">
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd">订单号</view>
				<view class="daui-cell__bd">{{orderInfo.order_no}}</view>
			</view>
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd">订单类型</view>
				<view class="daui-cell__bd">{{orderInfo.ord_type_show}}</view>
			</view>
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd">创建时间</view>
				<view class="daui-cell__bd">{{orderInfo.create_time_show}}</view>
			</view>
			<view class="daui-cell daui-cell_sm" v-if="orderInfo.pay_status==2">
				<view class="daui-cell__hd">支付时间</view>
				<view class="daui-cell__bd">{{orderInfo.pay_time_show}}</view>
			</view>
			<view class="daui-cell daui-cell_sm" v-if="orderInfo.pay_status==2">
				<view class="daui-cell__hd">支付方式</view>
				<view class="daui-cell__bd">{{orderInfo.pay_method_show}}</view>
			</view>
			<view class="daui-cell daui-cell_sm" v-if="orderInfo.pay_status==2">
				<view class="daui-cell__hd">流水号</view>
				<view class="daui-cell__bd">{{orderInfo.payment_trade_no}}</view>
			</view>
			<view class="daui-cell daui-cell_sm" v-if="orderInfo.ord_type==1">
				<view class="daui-cell__hd">配送状态</view>
				<view class="daui-cell__bd">{{orderInfo.delivery_status_show}}</view>
			</view>
			<view class="daui-cell daui-cell_sm" v-if="orderInfo.ord_type==1">
				<view class="daui-cell__hd">发货时间</view>
				<view class="daui-cell__bd">{{orderInfo.delivery_time_show}}</view>
			</view>
			<view class="daui-cell daui-cell_sm" v-if="0 && orderInfo.ord_type==1">
				<view class="daui-cell__hd">投保状态</view>
				<view class="daui-cell__bd">{{orderInfo.insure_status_show}}<text class="text-blue">(投保金额：{{orderInfo.insure_amount}})</text></view>
			</view>
			<view class="daui-cell daui-cell_sm" v-if="orderInfo.ord_type==1">
				<view class="daui-cell__hd">投保额度</view>
				<view class="daui-cell__bd text-blue">￥{{orderInfo.insure_amount}}</view>
			</view>
			<view class="daui-cell daui-cell_sm" v-if="orderInfo.ord_type==1">
				<view class="daui-cell__hd">配送方式</view>
				<view class="daui-cell__bd">{{orderInfo.delivery_mode_show}}</view>
			</view>
			<view class="daui-cell daui-cell_sm" v-if="orderInfo.ord_type==1">
				<view class="daui-cell__hd">快递公司</view>
				<view class="daui-cell__bd">{{orderInfo.expresscomp_name}}</view>
			</view>
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd">订单留言</view>
				<view class="daui-cell__bd">{{orderInfo.leaveword}}</view>
			</view>
		</view>
	</view>
	<view class="daui-card daui-card__full daui-card_access daui-card_one" v-if="orderInfo.invoice_id">
		<view class="daui-card__hd">发票信息</view>
		<view class="daui-card__bd daui-cells-preview">
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd daui-cell_primary">抬头</view>
				<view class="daui-cell__bd">
					{{invoiceInfo.name}}
				</view>
			</view>
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd daui-cell_primary">税号</view>
				<view class="daui-cell__bd">
					{{invoiceInfo.duty}}
				</view>
			</view>
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd daui-cell_primary">地址</view>
				<view class="daui-cell__bd">
					{{invoiceInfo.address}}
				</view>
			</view>
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd daui-cell_primary">电话</view>
				<view class="daui-cell__bd">
					{{invoiceInfo.phone}}
				</view>
			</view>
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd daui-cell_primary">银行卡</view>
				<view class="daui-cell__bd">
					{{invoiceInfo.bank_number}}
				</view>
			</view>
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd daui-cell_primary">开户行</view>
				<view class="daui-cell__bd">
					{{invoiceInfo.deposit_bank}}
				</view>
			</view>
		</view>
	</view>
	<view class="daui-card daui-card__full daui-card_access daui-card_one" v-if="orderInfo.show_pay_btn == 1">
		<view class="daui-card__hd">支付方式</view>
		<view class="daui-card__bd daui-cells-preview">
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd">网银支付</view>
				<view class="daui-cell__bd">
					<view class="daui-media daui-media_appmsg" v-for="(item,index) in bankcardList" :key="index">
						<view class="daui-media__bd">
							<view class="daui-media__work">账户名：{{item.name}}</view>
							<view class="daui-media__work">开户银行：{{item.deposit_bank}}</view>
							<view class="daui-media__work">银行账号：{{item.bank_number}}</view>
							<view class="daui-media__work">税号：{{item.duty}}</view>
							<view class="daui-media__work">营业地址：{{item.address}}</view>
						</view>
					</view>
				</view>
			</view>
			<!-- #ifdef MP-WEIXIN -->
			<label class="daui-cell daui-cell_sm" v-if="payMethodConfig.is_balance">
				<view class="daui-cell__hd margin-right-sm">余额支付</view>
				<view class="daui-cell__bd"><image src="/static/images/pay/balance.jpg" mode="widthFix" style="width:240rpx;"></image></view>
				<view class="daui-cell__ft"></view>
			</label>
			<view class="daui-cell daui-cell-label" v-if="payMethodConfig.is_wxpay">
				<view class="daui-cell__hd margin-right-sm">微信支付</view>
				<view class="daui-cell__bd"><image src="/static/images/pay/wxpay.jpg" mode="widthFix" style="width:240rpx" @click="submitPay('wxpay')"></image></view>
				<view class="daui-cell__ft"></view>
			</view>
			<!-- #endif -->
			<!-- #ifndef MP-WEIXIN -->
			<label class="daui-cell daui-cell_sm" v-if="payMethodConfig.is_balance">
				<view class="daui-cell__hd margin-right-sm">余额支付</view>
				<view class="daui-cell__bd"><image src="/static/images/pay/balance.jpg" mode="widthFix" style="width:240rpx;"></image></view>
				<view class="daui-cell__ft"></view>
			</label>
			<label class="daui-cell daui-cell_sm" v-if="payMethodConfig.is_wxpay">
				<view class="daui-cell__hd margin-right-sm">微信支付</view>
				<view class="daui-cell__bd"><image src="/static/images/pay/wxpay.jpg" mode="widthFix" style="width:240rpx" @click="submitPay('wxpay')"></image></view>
				<view class="daui-cell__ft"></view>
			</label>
			<label class="daui-cell daui-cell_sm" v-if="payMethodConfig.is_alipay">
				<view class="daui-cell__hd margin-right-sm">支付宝</view>
				<view class="daui-cell__bd"><image src="/static/images/pay/alipay.jpg" mode="widthFix" style="width:240rpx;" @click="submitPay('alipay')"></image></view>
				<view class="daui-cell__ft"></view>
			</label>
			<!-- #endif -->
		</view>
	</view>
	<view class="daui-card daui-card__full daui-card_access daui-card_one" v-if="orderInfo.evaluation_status == 2">
		<view class="daui-card__hd">订单评价</view>
		<view class="daui-card__bd">
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd daui-cell_primary">评分</view>
				<view class="daui-cell__bd">
					<star-rating @changeScore='onChange' name='scoreNum' :score='evaluationInfo.rate'></star-rating>
					{{evaluationInfo.rate_show}}
				</view>
			</view>
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd daui-cell_primary">评价内容</view>
				<view class="daui-cell__bd">
					<view>{{evaluationInfo.content}}</view>
					<ul class="daui-uploader__files clear mg-com-img">
						<block v-for="(item,index) in evaluationInfo.ictureList" :key="index">
						<li class="daui-uploader__file" style="background-image:url()"></li>
						</block>
					</ul>
				</view>
			</view>
			<view class="daui-cell daui-cell_sm">
				<view class="daui-cell__hd daui-cell_primary">评价时间</view>
				<view class="daui-cell__bd">{{evaluationInfo.create_time_show}}</view>
			</view>
		</view>
	</view>
	<view class="daui-card daui-card__full daui-card_access daui-card_one" v-if="gradationList.length > 0">
		<view class="daui-card__hd">核销明细</view>
		<view class="daui-card__bd">
			<view class="daui-media daui-media_appmsg daui-media_product" v-for="(item,index) in gradationList" :key="index">
				<view class="daui-media__bd">
					<view class="daui-media__title">{{item.prod_name}}</view>
					<view class="daui-media__work margin-top-xs" v-if="item.spec_1">
						规格：<text>{{item.spec_1}}</text>
						<text v-if="item.spec_2">，{{item.spec_2}}</text>
					</view>
					<view>核销时间：{{item.autotime}}</view>
				</view>
				<view class="daui-media__ft">
					数目：<text class="text-red">{{item.writeoff_num}}</text>
				</view>
			</view>
		</view>
	</view>
	<view class="daui-card daui-card_access daui-card_one" v-if="orderInfo.refund_status != 1">
		<view class="daui-card__hd">订单售后</view>
		<view class="daui-card__bd">
			<view class="daui-cell" v-if="orderInfo.refund_status != 1">
				状态：{{orderInfo.refund_status_show}}
				<view class="daui-cell__bd" v-if="orderInfo.refund_status == 8">
					退款{$vo['refund_fee']}元
				</view>
				<view class="daui-cell__bd" v-else-if="orderInfo.refund_status == 9">
					已全额退款
				</view>
			</view>
			<view class="daui-cell" v-for="(item,index) in refundList" :key="index">
				<view class="daui-cell__bd">
					<view class="fr">
						<span class="c-orange">{{item.status_show}}</span>
					</view>
					<view>
						<span class="mg-r-10">退款申请时间：</span>{{item.autotime}}
					</view>
					<view class="mb5">
						<span class="mg-r-10">退款理由：</span>{{item.apply_reason}}
					</view>
					<view>
						<ul class="zzui-picture">
							<li v-for="(item2,index2) in refundPictureGroup" :key="index2">
								<image :src="item2.picurl"></image>
							</li>
						</ul>
					</view>
				</view>
			</view>
		</view>
	</view>
	
	<view class="daui-bar input foot solid-top">
		<view class="action"></view>
		<view class="action">
			<button class="daui-btn line-primary circle margin-right-sm" @click="openBookdinnerModify" v-if="orderInfo.ord_type == 6 && orderInfo.trade_status == 1">修改菜品</button>
			<button class="daui-btn line-red circle margin-right-sm" @click="doCancel" v-if="orderInfo.trade_status == 1">取消订单</button>
			<button class="daui-btn line-cyan circle margin-right-sm" @click="showPayPopup" v-if="orderInfo.show_pay_btn == 1">立即支付</button>
			<button class="daui-btn line-cyan circle margin-right-sm" @click="openRefund" v-if="orderInfo.trade_status == 2 && mallConfigInfo.is_refund_apply == 1">订单退款</button>
			<button class="daui-btn line-red circle margin-right-sm" @click="openInvoicePublish" v-if="orderInfo.trade_status == 5 && orderInfo.invoice_id == 0">申请发票</button>
			<button class="daui-btn line-red circle margin-right-sm" @click="openEvaluationPublish" v-if="orderInfo.trade_status == 5 && orderInfo.evaluation_status == 1">我要评价</button>
			<button class="daui-btn line-red circle margin-right-sm" @click="doReceipt" v-if="orderInfo.trade_status == 3">确认收货</button>
		</view>
	</view>
	
	<uni-popup ref="payPopup" type="bottom">
		<view class="daui-compopup">
			<radio-group class="radio-group-block" @change="payMethodChange">
			<view class="daui-cells text-left">
				<!-- #ifdef MP-WEIXIN -->
				<label class="daui-cell daui-cell-label" v-if="payMethodConfig.is_balance">
					<view class="daui-cell__hd margin-right-sm"><image src="/static/images/pay/icon_balance.png" mode="aspectFill" style="width: 48rpx;height: 48rpx;"></image></view>
					<view class="daui-cell__bd">余额支付</view>
					<view class="daui-cell__ft"><radio value="balance" /></view>
				</label>
				<view class="daui-cell daui-cell-label" v-if="payMethodConfig.is_wxpay">
					<view class="daui-cell__hd margin-right-sm"><image src="/static/images/pay/icon_wxpay.png" mode="aspectFill" style="width: 48rpx;height: 48rpx;"></image></view>
					<view class="daui-cell__bd">微信支付</view>
					<view class="daui-cell__ft"><radio value="wxpay" /></view>
				</view>
				<!-- #endif -->
				<!-- #ifndef MP-WEIXIN -->
				<label class="daui-cell daui-cell-label" v-if="payMethodConfig.is_balance">
					<view class="daui-cell__hd margin-right-sm"><image src="/static/images/pay/icon_balance.png" mode="aspectFill" style="width: 48rpx;height: 48rpx;"></image></view>
					<view class="daui-cell__bd">余额支付</view>
					<view class="daui-cell__ft"><radio value="balance" /></view>
				</label>
				<label class="daui-cell daui-cell-label" v-if="payMethodConfig.is_wxpay">
					<view class="daui-cell__hd margin-right-sm"><image src="/static/images/pay/icon_wxpay.png" mode="aspectFill" style="width: 48rpx;height: 48rpx;"></image></view>
					<view class="daui-cell__bd">微信支付</view>
					<view class="daui-cell__ft"><radio value="wxpay" /></view>
				</label>
				<label class="daui-cell daui-cell-label" v-if="payMethodConfig.is_alipay">
					<view class="daui-cell__hd margin-right-sm"><image src="/static/images/pay/icon_alipay.png" mode="aspectFill" style="width: 48rpx;height: 48rpx;"></image></view>
					<view class="daui-cell__bd">支付宝支付</view>
					<view class="daui-cell__ft"><radio value="alipay" /></view>
				</label>
				<!-- #endif -->
				<view class="daui-cell">
					<view class="daui-cell__bd">
						<button type="button" class="daui-btn bg-primary round shadow block" @click="submitPay">确认无误去支付</button>
					</view>
				</view>
			</view>
			</radio-group>
		</view>
	</uni-popup>
	
	<!--toast提示-->
	<daui-toast ref="toast"></daui-toast>
</view>
</template>

<script>
import danceuiTool from '../../utils/danceuiTool';
import http from '../../server/api-mine.js';
import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue';
import xwCountDown from '@/components/xw-CountDown';
import starRating from '@/components/star-rating/star-rating';
export default {
	components: {
		tkiQrcode,
		xwCountDown,
		starRating
	},
	data() {
		return {
			mallConfigInfo: [],
			orderId: 0,
			orderInfo: {},
			orderProduct: [],
			orderDishgood: [],
			isLeavemessOpen: 0,
			leavemess_fields: [],
			refundList: [],
			recordInfo: {},
			balance_name: '',
			selfpickupInfo: {},
			consigneeInfo: {},
			gradationList: [],
			invoiceInfo: {},
			evaluationInfo: {},
			payMethodConfig: {},
			payMethod: '',
			bankcardList: [],
			writeoffUrl: '',
			status: 1
		}
	},
	onLoad(options) {
		console.log('onLoad的参数:', options);
		this.orderId = options.orderId;
		this.list_param = {orderId:options.orderId};
		this.balance_name = uni.getStorageSync('balance_name');
		this.getData();
	},
	onPullDownRefresh(){
		console.log('=====上拉刷新refresh');
		this.getData();
		setTimeout(() => {
			uni.stopPullDownRefresh()
		}, 200);
	},
	methods: {
		async getData(){ //请求并获取数据
			//获取用户登陆信息
			const token = uni.getStorageSync('token');
			let headers = {"Authorization":"Bearer "+token};
			let ret = await http.myOrderDetail(this.$refs.toast, this.list_param, headers);
			var retData = ret.data;
			console.log('myOrderDetail页面,获取到的数据：', retData);
			this.mallConfigInfo = retData.mallConfigInfo;
			this.orderInfo = retData.orderInfo;
			this.orderProduct = retData.orderProduct;
			this.orderDishgood = retData.orderDishgood;
			this.isLeavemessOpen = retData.isLeavemessOpen;
			this.leavemess_fields = retData.leavemess_fields;
			this.payMethodConfig = retData.payMethodConfig;
			this.gradationList = retData.gradationList;
			this.selfpickupInfo = retData.selfpickupInfo;
			this.consigneeInfo = retData.consigneeInfo;
			if(retData.orderInfo.refund_status != 1){
				console.log(retData.refundList);
				this.refundList = retData.refundList;
			}
			if(retData.orderInfo.ord_type == 31){
				this.recordInfo = retData.recordInfo;
			}
			if(retData.orderInfo.evaluation_status == 2){
				this.evaluationInfo = retData.evaluationInfo;
			}
			if(retData.orderInfo.invoice_id){
				this.invoiceInfo = retData.invoiceInfo;
			}
			if(retData.orderInfo.trade_status == 1){
				this.bankcardList = retData.bankcardList;
			}
			if(retData.orderInfo.trade_status == 2){
				this.writeoffUrl = '/pagesA/order/writeoff?orderId='+this.orderId;
				console.log('writeoffUrl:', this.writeoffUrl);
				//this.creatQrcode(); //生成二维码
			}
		},
		qrcode2229Complete(e) {
			console.log('qrcode2229Complete', e)
		},
		creatQrcode() { //生成二维码
			console.log('qrcode:', this.$refs.qrcode1)
			//this.$refs.qrcode1._makeCode()
		},
		qrR(res) {
			console.log('qrR');
			this.src = res
		},
		doCancel(){ //提交事件
			var that = this;
			uni.showModal({
				title: '提示',
				content: '确认取消订单吗？',
				success: function (res) {
					if (res.confirm) {
						that.doCancelTwo();
					} else if (res.cancel) {
						console.log('用户点击取消');
					}
				}
			});
		},
		async doCancelTwo(){
			//获取用户登陆信息
			const token = uni.getStorageSync('token');
			let headers = {"Authorization":"Bearer "+token};
			var param = {
				orderId: this.orderId
			};
			let ret = await http.orderDoCancel(this.$refs.toast, param, headers);
			var retData = ret.data;
			this.getData();
		},
		doReceipt(){ //提交事件
			var that = this;
			uni.showModal({
				title: '提示',
				content: '确认收货吗？',
				success: function (res) {
					if (res.confirm) {
						that.doReceiptTwo();
					} else if (res.cancel) {
						console.log('用户点击取消');
					}
				}
			});
		},
		async doReceiptTwo(){
			//获取用户登陆信息
			const token = uni.getStorageSync('token');
			let headers = {"Authorization":"Bearer "+token};
			var param = {
				orderId: this.orderId
			};
			let ret = await http.orderDoReceipt(this.$refs.toast, param, headers);
			var retData = ret.data;
			this.getData();
		},
		showPayPopup(){
			this.$refs.payPopup.open();
		},
		payMethodChange(e){
			console.log('选择的值:', e.target.value);
			this.payMethod = e.target.value;
		},
		submitPay(payMethod){
			//#ifdef H5
			if(payMethod == 'wxpay'){
				window.location.href = this.danceData.webURL+'/index.php?s=/mobmall/wxpay/doJsapi/orderId/'+this.orderId;
			}else if(payMethod == 'alipay'){
				window.location.href = this.danceData.webURL+'/index.php?s=/mobmall/alipayTradeWap/doAlipay/orderId/'+this.orderId;
			}else if(payMethod == 'balance'){
				uni.navigateTo({
					url: '/pagesA/recharge/payment?orderId='+this.orderId
				});
			}
			//#endif
			
			//#ifdef MP-WEIXIN
			if(payMethod == 'wxpay'){
				this.doWxpay();
			}else if(payMethod == 'balance'){
				uni.navigateTo({
					url: '/pagesA/recharge/payment?orderId='+this.orderId
				});
			}
			//#endif
			
			//#ifdef APP-PLUS
			if(payMethod == 'wxpay'){
				this.weixinLoginAppPlus();
			}else if(payMethod == 'alipay'){
				this.doAlipayForAppPlus();
			}else if(payMethod == 'balance'){
				uni.navigateTo({
					url: '/pagesA/recharge/payment?orderId='+this.orderId
				});
			}
			//#endif
		},
		//#ifdef APP-PLUS
		weixinLoginAppPlus(){
			console.log('=====wxLoginAppPlus开始');
			let that = this;
			uni.login({
				provider: 'weixin',
				success: function (loginRes) {
					console.log('loginRes.authResult:', loginRes.authResult);
					//danceuiTool.showToast('', 'loginRes.authResult:'+loginRes.authResult);
					// 获取用户信息
					uni.getUserInfo({
						provider: 'weixin',
						success: function (infoRes) {
							//danceuiTool.showToast('用户昵称为：' + infoRes.userInfo.nickName);
							console.log('获取到的用户信息:', JSON.stringify(infoRes.userInfo));
							//danceuiTool.showToast('获取用户信息:', JSON.stringify(infoRes.userInfo));
							that.doWxpayForAppPlus(infoRes.userInfo);
						}
					});
				}
			});
		},
		async doWxpayForAppPlus(userInfo){
			let that = this;
			//获取用户登陆信息
			const token = uni.getStorageSync('token');
			let headers = {"Authorization":"Bearer "+token};
			var platform = 'app-plus';
			var param = {
				openid: userInfo.openId,
				unionid: userInfo.unionId,
				orderId: this.orderId,
				platform: platform
			}
			let ret = await http.wxpayDoJsapi(this.$refs.toast, param, headers, 1);
			var retData = ret.data;
			console.log('wxpayDoJsapi,请求数据：', retData);
			if(typeof retData != undefined){
				uni.requestPayment({
					provider: 'wxpay',
					orderInfo: retData.orderInfo,
					success: (res) => {
						console.log('success:' + JSON.stringify(res));
						//danceuiTool.showToast('success:' + JSON.stringify(res));
						danceuiTool.showToast(this.$refs.toast, '支付成功');
						that.$refs.payPopup.close();
						that.getData();
					},
					fail: (err) => {
						console.log('fail:' + JSON.stringify(err));
						//danceuiTool.showToast('fail:' + JSON.stringify(err));
						uni.showModal({
							content: "支付失败,原因为: " + err.errMsg,
							showCancel: false
						})
						that.$refs.payPopup.close();
					},
					complete: () => {
						
					}
				})
			}
		},
		async doAlipayForAppPlus(){
			let that = this;
			//获取用户登陆信息
			const token = uni.getStorageSync('token');
			let headers = {"Authorization":"Bearer "+token};
			var platform = 'app-plus';
			var param = {
				orderId: this.orderId,
				platform: platform
			}
			let ret = await http.doAlipay(this.$refs.toast, param, headers, 1);
			var retData = ret.data;
			console.log('doAlipay,请求数据:', retData);
			if(typeof retData != undefined){
				uni.requestPayment({
					provider: 'alipay',
					orderInfo: retData.orderInfo,
					success: (res) => {
						console.log('success:' + JSON.stringify(res));
						//danceuiTool.showToast('success:' + JSON.stringify(res));
						danceuiTool.showToast(this.$refs.toast, '支付成功');
						that.$refs.payPopup.close();
						that.getData();
					},
					fail: (err) => {
						console.log('fail:' + JSON.stringify(err));
						//danceuiTool.showToast('fail:' + JSON.stringify(err));
						uni.showModal({
							content: "支付失败,原因为: " + err.errMsg,
							showCancel: false
						})
						that.$refs.payPopup.close();
					},
					complete: () => {
						
					}
				})
			}
		},
		//#endif
		//#ifdef MP-WEIXIN
		async doWxpay(){
			var that = this;
			//获取用户登陆信息
			const token = uni.getStorageSync('token');
			let headers = {"Authorization":"Bearer "+token};
			var platform = 'mp-weixin';
			var param = {
				orderId: this.orderId,
				platform: platform
			}
			let ret = await http.wxpayDoJsapi(this.$refs.toast, param, headers);
			var retData = ret.data;
			console.log('wxpayDoJsapi,请求数据：', retData);
			if(typeof retData != undefined){
				uni.requestPayment({
					timeStamp: retData.jsApiParameters.timeStamp,
					nonceStr: retData.jsApiParameters.nonceStr,
					package: retData.jsApiParameters.package,
					signType: 'MD5',
					paySign: retData.jsApiParameters.paySign,
					success: (res) => {
						danceuiTool.showToast(this.$refs.toast, '支付成功');
						that.$refs.payPopup.close();
						that.getData();
					},
					fail: (res) => {
						uni.showModal({
							content: "支付失败,原因为: " + res.errMsg,
							showCancel: false
						})
					},
					complete: () => {
						this.loading = false;
					}
				})
			}
		},
		//#endif
		openRefund(){
			uni.navigateTo({
				url: '/pagesA/order/refund?orderId='+this.orderId
			});
		},
		openInvoicePublish(){
			uni.navigateTo({
				url: '/pagesA/invoice/publish?orderId='+this.orderId
			});
		},
		openEvaluationPublish(){
			uni.navigateTo({
				url: '/pagesA/evaluation/publish?orderId='+this.orderId
			});
		},
		openProductDetail(pid){
			uni.navigateTo({
				url: '/pages/product/productDetail?pid='+pid
			});
		},
		openShopDetail(shid){
			uni.navigateTo({
				url: '/pages/shop/shopDetail?shid='+shid
			});
		}
	}
}
</script>

<style>
.order-header{padding: 38rpx 66rpx;background-color: #EB0909;}
.order-header .order-title{color: #ffffff;font-size: 36rpx;}
.order-header .order-reason{font-size:24rpx;line-height:24rpx;color:rgba(254,254,254,0.75);padding-top:4rpx;display:flex;align-items:center}
.order-header .order-reason .red{}
.order-header .order-status-img{width:80rpx;height:80rpx;display:block}
</style>
